/*
 * Copyright (c) 2010, Davide Brugali, All right reserved
 * 
 * Project MotionPlanning
 * 
 * Package motionplanning.cartspace.framework
 */
package star.core.util.geometry;

public class Quaternion {

	private double x;
	private double y;
	private double z;
	private double w;

	public Quaternion(double x, double y, double z, double w)
	{
		this.x=x;
		this.y=y;
		this.z=z;
		this.w=w;
	}

	public double getX()
	{
		return this.x;
	}
	
	public double getY()
	{
		return this.y;	
	}
	
	public double getZ()
	{
		return this.z;
	}
	
	public double getW()
	{
		return this.w;
	}
	
	public double length2()
	{
		return this.dot(this,this);
	}

	public double dot(Quaternion q1, Quaternion q2)
	{
		return q1.getX() * q2.getX() + q1.getY() * q2.getY() + q1.getZ() * q2.getZ() + q1.getW() * q2.getW();
	}

}
